package org.x.lawyermod.controller;

import com.mybatisflex.annotation.UseDataSource;
import org.springframework.web.bind.annotation.*;
import org.x.lawyermod.dto.LawyerListDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.x.lawyermod.dto.LawyerUpdateDTO;
import org.x.lawyermod.service.ILawyerService;
import org.x.commonmod.config.Result;

/**
 * 律师信息表 控制层。
 *
 * @author mybatis-flex-helper automatic generation
 * @since 1.0
 */
@UseDataSource("caseDS")
@RestController
@RequestMapping("/api/lawyer")
public class LawyerController {

    @Autowired
    private ILawyerService lawyerService;
    /**
     * 查询所有律师信息表
     * 分页查询
     * @return 所有数据
     */
    @GetMapping("/pagelist")
    public Result pagelist(@ModelAttribute LawyerListDTO lawyerListDTO) {
        return Result.ok(lawyerService.pagelist(lawyerListDTO));

    }
    /**
     * 跟新律师信息表
     * @param lawyerUpdateDTO lawyer
     * @return 添加结果
     */
    @PostMapping("/update")
    public Result update(@RequestBody LawyerUpdateDTO lawyerUpdateDTO) {
        return Result.ok(lawyerService.updateById(lawyerUpdateDTO));
    }

}